<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div id="app">
        <p>{{msg}}</p>
        <input type="button" value="创建vue实例" onclick="createVue()">
    </div>
</body>
<script>
     var emlentObj = {
        tag:"div",
        content:[
            "文本",
            {
                tag:"p",
                content:[

                ]
            }
        ]
    };
    function render(domObj){
        var domEl=document.createElement(domObj.tag);
        var domContent="";
        var doms=[];
        for(let i in domObj.content){
            if(typeof domObj.content[i]==="string"){
                domContent+=domObj.content[i];
            }else{
                var dom=render(domObj.content[i]);
                doms.push(dom);
            }
        }
        domEl.innerHTML=domContent;
        for(let key in doms){
            domEl.appendChild(doms[key]);
        }
        return domEl;
    }
    var a=render(emlentObj);
    console.log(a);
    function createVue(){
        var vm=new Vue({
            el:"#app",
            data:{
                msg:"初始变量"
            }
        })
    }
</script>
</html>